package com.lpit.service.impl;

import com.lpit.mapper.CertificationMapper;
import com.lpit.mapper.FeedbackMapper;
import com.lpit.pojo.Certification;
import com.lpit.pojo.Feedback;
import com.lpit.result.ResponseResult;
import com.lpit.service.UserCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserCenterServiceImpl implements UserCenterService {

    @Autowired
    private CertificationMapper certificationMapper;

    @Autowired
    private FeedbackMapper feedbackMapper;

    /*用户认证资料*/
    @Override
    public ResponseResult<Integer> userAuthentication(Certification certification) {
        if (null == certification){
            certification = new Certification();
        }
        certification.setCertificationStatus("审核中");
        int insert = certificationMapper.insert(certification);
        if (insert == 1){
            return new ResponseResult<>(insert);
        }

        return new ResponseResult<>(insert,"数据插入失败");
    }

    /*用户反馈*/
    @Override
    public ResponseResult<Integer> userFeedback(Feedback feedback) {
        if(null == feedback){
            feedback = new Feedback();
        }
        int insert = feedbackMapper.insert(feedback);
        if (insert == 1){
            return new ResponseResult<>(insert);
        }
        return new ResponseResult<>(insert,"数据插入失败");
    }

}
